const express = require('express')
const path = require('path')
const mongoose = require('mongoose')
const logger = require('morgan');

const app = express()

mongoose.connect('mongodb://127.0.0.1:12580/test')

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));

app.use(express.static(path.join(__dirname, 'public')));

app.get('/', async (req, res) => {
	res.send('hello')
})

app.use('/api', require('./routes/api').router)

module.exports = app
